package com.quectel.util.common;

import cn.hutool.crypto.digest.BCrypt;

/**
 * 密码帮助类
 *
 * @author: caolu
 * @email: louis.cao@quectel.com
 * @date: 2022-05-17 11:32:00
 */
public class PasswordUtils {
    /**
     * 加密密码
     *
     * @param password
     * @return
     */
    public static String hashpw(String password) {
        return BCrypt.hashpw(password, BCrypt.gensalt());
    }

    /**
     * 密码校验
     *
     * @param password
     * @return
     */
    public static boolean matchPassword(String password, String hashedPassword) {
        return BCrypt.checkpw(password, hashedPassword);
    }
}
